#!/bin/bash
token=a0446608971ec088010cfbfc1b879fff
body=/retest
do_comments(){
curl -s -f -X POST --header 'Content-Type: application/json;charset=UTF-8' "https://gitee.com/api/v5/repos/src-openeuler/$name/pulls/$num/comments" -d "{\"access_token\":\"$token\",\"body\":\"$body\"}" &>/dev/null || echo "$name comments error"
}

while read x;do
	name=$(echo $x | awk '{print $1}')
	num=$(echo $x | awk '{print $2}')
	if [ $num -gt 0 ] &>/dev/null;then
	       	do_comments
		echo "$name $num retest is succeed!"
	else
		echo "$name $num retest is failed!"
	fi
done < package_list
